package me.leiusual.sharing.ui.useraccount

import androidx.lifecycle.ViewModel
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap
import me.leiusual.sharing.di.FragmentScope
import me.leiusual.sharing.di.ViewModelKey

/**
 * author: leiusual
 * create on: 2019-08-06
 * description:
 */
@Module
abstract class UserAccountModule {

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun userAccountDetailFragment(): UserAccountDetailFragment

  @Binds
  @IntoMap
  @ViewModelKey(UserAccountDetailViewModel::class)
  abstract fun userAccountDetailViewModel(userAccountDetailViewModel: UserAccountDetailViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun userAccountFragment(): UserAccountFragment

  @Binds
  @IntoMap
  @ViewModelKey(UserAccountViewModel::class)
  abstract fun userAccountViewModel(userAccountViewModel: UserAccountViewModel): ViewModel
}